package com.lcxw.hxzbapi.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lcxw.hxzbapi.dao.mapper.IncomeMapper;
import com.lcxw.hxzbapi.entity.pojo.Income;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;

@Component
public class IncomeService {

    @Resource
    IncomeMapper incomeMapper;

    public int insert(Income income) {
        return incomeMapper.insert(income);
    }

    public double getTodayIncome(long userId, String from, String to) {

        Double todayIncome = incomeMapper.getTodayIncome(userId, from, to);
        if (todayIncome == null) {
            todayIncome = 0.00;
        }

        return todayIncome;
    }
}
